﻿namespace TfsCloudDeploy.Workflow.Tests.Mocks
{
    using System;

    using Microsoft.TeamFoundation.Build.Client;
    using Microsoft.TeamFoundation.Build.Workflow;
    using TfsCloudDeploy.Workflow.Tests.Utility;

    internal class BuildDetail : IBuildDetail
    {
        #region Events
#pragma warning disable 0067

        public event PollingCompletedEventHandler PollingCompleted;

        public event StatusChangedEventHandler StatusChanged;

        public event StatusChangedEventHandler StatusChanging;

#pragma warning restore 0067
        #endregion Events

        #region Properties

        public IBuildAgent BuildAgent
        {
            get { return null; }
        }

        public Uri BuildAgentUri
        {
            get { return new Uri("vstfs:///Build/Agent/1"); }
        }

        public IBuildController BuildController
        {
            get { return new BuildController(); }
        }

        public Uri BuildControllerUri
        {
            get { return new Uri("vstfs:///Build/Controller/1"); }
        }

        public IBuildDefinition BuildDefinition
        {
            get { return new BuildDefinition(); }
        }

        public Uri BuildDefinitionUri
        {
            get { return new Uri("vstfs:///Build/Definition/1"); }
        }

        public bool BuildFinished
        {
            get { return true; }
        }

        /// <summary>
        /// Override the BuildNumber property to return a value for test purposes
        /// </summary>
        public string BuildNumber
        {
            get { return "Test_20100720.2"; }
            set { }
        }

        public IBuildServer BuildServer
        {
            get { return new BuildServer(); }
        }

        public string CommandLineArguments
        {
            get { return string.Empty; }
        }

        public BuildPhaseStatus CompilationStatus
        {
            get
            {
                return BuildPhaseStatus.Succeeded;
            }
            set
            {
            }
        }

        public string ConfigurationFolderPath
        {
            get { return string.Empty; }
        }

        public Uri ConfigurationFolderUri
        {
            get { return new Uri("vstfs:///Build/Build/1"); }
        }

        public string DropLocation
        {
            get
            {
                return string.Empty;
            }
            set
            {
            }
        }

        public string DropLocationRoot
        {
            get { return @"\\DropServer\Drops"; }
        }

        public DateTime FinishTime
        {
            get { return DateTime.Now; }
        }

        public IBuildInformation Information
        {
            get { return null; }
        }

        public bool IsDeleted
        {
            get { return false; }
        }

        public bool KeepForever
        {
            get
            {
                return false;
            }
            set
            {
            }
        }

        public string LabelName
        {
            get
            {
                return "Test_20100720.1";
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public string LastChangedBy
        {
            get { return "Test"; }
        }

        public DateTime LastChangedOn
        {
            get { return DateTime.Now; }
        }

        public string LogLocation
        {
            get
            {
                return "Logs";
            }
            set
            {
            }
        }

        public string ProcessParameters
        {
            get { return WorkflowHelpers.SerializeProcessParameters(WorkflowTestHelpers.GetProcessParameters()); }
        }

        public string Quality
        {
            get
            {
                return string.Empty;
            }
            set
            {
            }
        }

        public BuildReason Reason
        {
            get { return BuildReason.Manual; }
        }

        public string RequestedBy
        {
            get { return "Test"; }
        }

        public string RequestedFor
        {
            get { return "Test"; }
        }

        public string ShelvesetName
        {
            get { return string.Empty; }
        }

        public string SourceGetVersion
        {
            get
            {
                return string.Empty;
            }
            set
            {
            }
        }

        public DateTime StartTime
        {
            get { return DateTime.Now; }
        }

        public BuildStatus Status
        {
            get
            {
                return BuildStatus.Succeeded;
            }
            set
            {
            }
        }

        public string TeamProject
        {
            get { return "TestProject"; }
        }

        public BuildPhaseStatus TestStatus
        {
            get
            {
                return BuildPhaseStatus.Succeeded;
            }
            set
            {
            }
        }

        public Uri Uri
        {
            get { return new Uri("vstfs:///Build/Build/1"); }
        }

        #endregion Properties

        #region Methods

        public void Connect()
        {
        }

        public void Connect(int pollingInterval, System.ComponentModel.ISynchronizeInvoke synchronizingObject)
        {
        }

        public IBuildDeletionResult Delete(DeleteOptions options)
        {
            return null;
        }

        public IBuildDeletionResult Delete()
        {
            return null;
        }

        public void Disconnect()
        {
        }

        public void FinalizeStatus(BuildStatus status)
        {
        }

        public void FinalizeStatus()
        {
        }

        public string GetServerItemForLocalItem(Guid outputGuid, int outputAge, string localPath)
        {
            return null;
        }

        public string GetServerItemForLocalItem(Guid outputGuid, int outputAge, string localPath, bool refresh)
        {
            return null;
        }

        public void Refresh(string[] informationTypes, QueryOptions queryOptions)
        {
        }

        public void RefreshAllDetails()
        {
        }

        public void RefreshMinimalDetails()
        {
        }

        public void Save()
        {
        }

        public void Stop()
        {
        }

        public void Wait()
        {
        }

        #endregion Methods
    }
}